<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ page import= "com.bean.dingdanBean" %>
    <%@ page import= "java.util.*" %>
<!DOCTYPE html>
<html>
    <head>
		<meta charset="utf-8">
		<title>订单管理</title>
		
		 <style>
body, html {  
        margin: 0;  
        padding: 0;  
        height: 100%;  
        overflow-x: hidden; /* 防止水平滚动条 */  
    }  
  
    body {  
        
         
        background-position: center;  
        background-attachment: fixed; 

          
    }  
  body::before {  
    content: "";  
    position: fixed; /* 使用fixed定位以匹配background-attachment: fixed */  
    top: 0;  
    left: 0;  
    width: 100%;  
    height: 100%;  
    z-index: -1; 
    background-image: url('./image/image1.jpg');  
    background-size: cover;  
    background-repeat: no-repeat;  
    background-position: center;  
    background-blend-mode: lighten;  
    background-color: rgba(255, 255, 255, 0.2);
}  
  .content {  

        padding: 20px; /* 内容区域的内边距 */  

    } 		 	 
		 /* 样式表 */
.container {
    margin: 50px auto; /* 居中显示 */
    max-width: 600px; /* 设置最大宽度 */
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    background-color: rgba(249, 249, 249, 0.5);
}

.form-control {
    width: 100%;
    padding: 8px;
    margin: 5px 0;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.btn {
    display: inline-block;
    padding: 8px 12px;
    margin: 5px;
    border: 1px solid #2ecc71;
    border-radius: 4px;
    background-color: #2ecc71;
    color: white;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #27ae60;
}
		 
		 
		 
		 
        /* 基本样式 */
        table {
            width: 100%;
            border-collapse: collapse;
            font-family: Arial, sans-serif;
            font-size: 14px;
            color: #333;
        }

        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
        }

        /* 统一底色 */
        tr td {
            background-color: #f2f2f2;
        }
        
         #menu {
            position: absolute;
            top: 10px;
            right: 10px;
        }
  .parent {  
    display: flex;  
    justify-content: center; 
}  
.flex-container {  

    display: flex;  

    justify-content: flex-end;  

}       
    </style>
		
		<script >
			function submitit1() {
			document.form2.action =
			"Dd_orderRoot"
			document.form2.submit();}
			
			function submitit2() {
			document.form2.action =
			"Dd_accountRoot"
			document.form2.submit();}
			
			function submitit3() {
			document.form2.action =
			"Dd_commodityRoot"
			document.form2.submit();}
			
			function submitit4() {
			document.form2.action =
			"Stat0Root"
			document.form2.submit();}
			
			function submitit5() {
			document.form2.action =
			"Stat1Root"
			document.form2.submit();}
			
		</script>
		
	</head>


    <body >
    

<script>
function redirectToPage(selectElement) {  
    // 获取选择的值  
    var selectedValue = selectElement.value;  
    // 如果选择了一个有效的页面，则跳转到该页面  
    if (selectedValue) {  
        window.location.href = selectedValue;  
    }  
}  

window.onload = function() {  
    // 获取所有具有指定类名的<select>元素  
    var selectElements = document.getElementsByClassName('menu-select');  
    // 遍历这些元素并添加事件监听器  
    for (var i = 0; i < selectElements.length; i++) {  
        selectElements[i].addEventListener('change', function() {  
            redirectToPage(this); 
        });  
    }  
};
</script>

    
    
    

<div class="container">
<div class="flex-container">
<select class="menu-select" onchange="redirectToPage()">
    <option value="" selected>个人账户</option>
    <option value="change.jsp">修改密码</option>
    <option value="index.jsp">货架管理</option>
    <option value="ausersRoot.jsp">用户管理</option>
    <option value="login.jsp">退出登录</option>
</select>
</div>
	<div class="parent">
		<div class="col-md-12 column">
			<h3 class="text-center">
				订单管理
			</h3>
		</div>
	</div> 
	<div class="row clearfix">
		<div class="col-md-12 column">
			
			
			<form class="form-horizontal" role="form" name="form2" METHOD="POST">
				<div class="form-group">
					 <label for="inputEmail35" class="col-sm-2 control-label">请输入需要查询的 订单号/用户名/商品名 并点击相应按钮</label>
					 <div class="col-sm-10">
						<input type="text" class="form-control" id="inputPassword35" name="C"/>
					</div>
				</div>
				
				
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						 <button type="submit" class="btn btn-default" onClick=submitit1();>订单号</button>
						 <button type="submit" class="btn btn-default" onClick=submitit2();>用户名</button>
						 <button type="submit" class="btn btn-default" onClick=submitit3();>商品名</button>
						 <button type="submit" class="btn btn-default" onClick=submitit4();>未出库</button>
						 <button type="submit" class="btn btn-default" onClick=submitit5();>已出库</button>
						  <%
							String state = (String) session.getAttribute("C1");
										session.removeAttribute("C1"); 
							if(state!=null){
								out.print(state);
							}
							%>
						
							
					</div>
							
					</div>
				
				</form>
					
				
			
				
<table>
    <thead>
        <tr>
        	<th>订单编号</th>
            <th>用户</th>
            <th>商品</th>
            <th>数量</th>
            <th>总价</th>
            <th>状态</th>
        </tr>
    </thead>
    <tbody>
    
    
    	<%
    	//获取对象a
		ArrayList dingdanstate = (ArrayList) session.getAttribute("dingdanMessage");
		session.removeAttribute("dingdanMessage"); 
		if(dingdanstate!=null){//数据不为空，执行成功
			for(int i=0;i<dingdanstate.size();i++){//遍历表有多少条数据
				dingdanBean temp = (dingdanBean) dingdanstate.get(i);//i 获取 类型huojiaBean 临时temp 的值，括号内为强制转换类型

				%>
				
			<tr>
            <td><%= temp.getDd_order() %></td>
            <td><%= temp.getDd_account() %></td>
            <td><%= temp.getDd_commodity() %></td>
            <td><%= temp.getDd_number() %></td>
            <td><%= temp.getTotal_price() %></td>
            <td><%= temp.getStat() %></td>
       		</tr>

				
				<%
			}
		}
		%>
    
       
        
    </tbody>
</table>

		</div>
	</div>
</div>

	</body>
	
</html>
